/**
 *
 * Copyright by Samuel Castro & Joaquim Fonseca, 2011
 * All Rights Reserved
 *
 * NOTES:
 * Please do not redistribute this plugin without my permission
 * Plugin made for private use only
 *
 */
package com.SyDeck.sdCities;

import com.nijiko.coelho.iConomy.iConomy;

/**
 *
 * @author Deck
 */
public class cEconomy {

    CityInfo ci = new CityInfo();

    public int Price(String City) {
        int price = ci.getXsize(City) * ci.getYsize(City);
        return price;
    }

    public String CurrPrice(String City) {
        int price = Price(City);
        return price + " " + iConomy.getBank().getCurrency();
    }

    public boolean pay(String City, String Player) {
        if (iConomy.getBank().getAccount(Player).hasEnough(Price(City))) {
            iConomy.getBank().getAccount(Player).subtract(Price(City));
            return true;
        }
        return false;
    }
}
